package com.mashibing.test.case8;

import com.mashibing.test.case8.cat.Cat;
import com.mashibing.test.case8.dog.Dog;
import com.mashibing.test.case8.dog.impl.JmDog;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class Master {

	@Autowired
	private Cat boCat;

	@Autowired
	@Qualifier("ydCat")
	private Cat cat2;

	private Cat cat3;

	@Autowired
	public void setCat3(Cat tomcat) {
		this.cat3 = tomcat;
	}

	@Lazy
	@Resource
	private Dog hskDog;

	@Resource(name = "jmDog")
	//@Resource(type = JmDog.class)
	private Dog dog2;

	private Dog dog3;

	@Resource(name = "smyDog")
	public void setDog3(Dog dog3) {
		this.dog3 = dog3;
	}

	@Override
	public String toString() {
		return "Master{" +
				"boCat=" + boCat +
				", cat2=" + cat2 +
				", cat3=" + cat3 +
				", hskDog=" + hskDog +
				", dog2=" + dog2 +
				", dog3=" + dog3 +
				'}';
	}
}
